package javaweb.thread;

import java.util.Hashtable;
import java.util.Map;
import java.util.Random;
import java.lang.ThreadLocal;
/**
 * @author shkstart
 * @creat -08-09 23:19
 */
public class ThreadLocalTest {
   // public static Map<String, Object> data = new Hashtable<>();
    private static Random random = new Random();
    private static ThreadLocal threadLocal=new ThreadLocal<Object>();
    public static class Task implements Runnable {
     public static void main(String[] args) {
    for (int i=0;i<3;i++){
     new Thread(new Task()).start();
    }
     }
        @Override
        public void run() {
            int i = random.nextInt(1000);
            String name = Thread.currentThread().getName();
            threadLocal.set(i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
